package com.usian.user.controller;


import com.usian.api.user.LoginControllerApi;
import com.usian.model.common.dtos.ResponseResult;
import com.usian.model.user.dtos.AdUserDto;
import com.usian.user.service.UserLoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/login")
public class LoginController implements LoginControllerApi {
    @Autowired
    private UserLoginService userLoginService;


    @Override
    @RequestMapping("/in")
    public ResponseResult login(@RequestBody AdUserDto dto) {
        return userLoginService.login(dto);
    }

    @RequestMapping("/inTwo")
    public ResponseResult inTwo(@RequestBody AdUserDto adUserDto){
        return userLoginService.loginTwo(adUserDto);
    }
    @RequestMapping("sendCode")
    public ResponseResult sendCode(String phone) throws Exception {
        userLoginService.sendCode(phone);
        return ResponseResult.okResult(phone);
    }
}
